from vnpy_ctastrategy.template import(
    CtaTemplate
)
from vnpy.trader.object import(
    BarData,
    TickData
)
from vnpy.trader.utility import(
    BarGenerator,
    ArrayManager
)
from typing import Any

class Show(CtaTemplate):
    """"""

    author="Max Show"

    fast_window=10
    slow_window=20

    fast_ma0=0.0
    fast_ma1=0.0
    slow_ma0=0.0
    slow_ma1=0.0

    parameters=[
        "fast_window",
        "slow_window"
        
    ]

    variables=[
        "slow_ma0",
        "slow_ma1",
        "slow_ma0",
        "slow_ma1"
    ]

    def __init__(self, cta_engine: Any, strategy_name: str, vt_symbol: str, setting: dict) -> None:
        super().__init__(cta_engine, strategy_name, vt_symbol, setting)
        self.bg = BarGenerator(self.on_bar)
        self.am = ArrayManager()

    def on_init(self) -> None:
        self.write_log("Max Demo 策略初始化")
        self.load_bar(10)

    def on_start(self) -> None:
        self.write_log("Max Demo 策略启动")
    
    def on_stop(self) -> None:
        self.write_log("Max Demo 策略停止")

    def on_tick(self, tick: TickData) -> None:
        self.write_log("get Tick1")
        self.write_log(tick.ask_price_1)
        self.write_log(tick.ask_price_2)